package bean;

import java.util.HashMap;
import java.util.StringTokenizer;

public class Xaml {
	public String xname;
	public String xclass;
	public HashMap<String, String> operations;
	
	
	
	public Xaml() {
		this.operations = new HashMap<String, String>();
	}

	public String getXname() {
		return xname;
	}

	public void setXname(String xname) {
		this.xname = xname;
	}

	public String getXclass() {
		return xclass;
	}

	public void setXclass(String xclass) {
		this.xclass = xclass;
	}


	public String cabecalho(){
		return  "<SequentialWorkflowActivity  x:Name=\"" + "Demo\" " + "x:Class=\""+ "FooBar.Demo" + "\" \n" +
	" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" \n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">";
	} 
	
	public void addHash(String name, String refers){
		this.operations.put(name, refers);
	}
	
	public String getXaml(){
		StringBuilder xaml = new StringBuilder();
		xaml.append(cabecalho());
		return xaml.toString();
	}
	
	public String gethashrefers(String nome){
		String ref = this.operations.get(nome).toString();
		StringTokenizer st = new StringTokenizer(ref, ":"); 
		return st.nextToken();
	}
	
	public String getMethodName(String nome){
		String ref = this.operations.get(nome).toString();
		StringTokenizer st = new StringTokenizer(ref, ":"); 
		st.nextToken();
		return st.nextToken();
	}

}
